//! A generic connection pool.
//!
//! Opening a new database connection every time one is needed is both
//! inefficient and can lead to resource exhaustion under high traffic
//! conditions. A connection pool maintains a set of open connections to a
//! database, handing them out for repeated use.
//!
//! r2d2 is agnostic to the connection type it is managing. Implementors of the
//! `ManageConnection` trait provide the database-specific logic to create and
//! check the health of connections.
//!
//! # Example
//!
//! Using an imaginary "foodb" database.
//!
//! ```rust,ignore
//! use std::thread;
//!
//! extern crate r2d2;
//! extern crate r2d2_foodb;
//!
//! fn main() {
//!     let manager = r2d2_foodb::FooConnectionManager::new("localhost:1234");
//!     let pool = r2d2::Pool::builder()
//!         .max_size(15)
//!         .build(manager)
//!         .unwrap();
//!
//!     for _ in 0..20 {
//!         let pool = pool.clone();
//!         thread::spawn(move || {
//!             let conn = pool.get().unwrap();
//!             // use the connection
//!             // it will be returned to the pool when it falls out of scope.
//!         })
//!     }
//! }
//! ```
#![warn(missing_docs)]
#![doc(html_root_url = "https://docs.rs/r2d2/0.8")]

#[macro_use]
extern crate log;


pub use crate::builder::Builder;
pub use crate::event::{NopEventHandler, HandleEvent, AcquireEvent, ReleaseEvent, CheckoutEvent, CheckinEvent};
pub use crate::extensions::Extensions;
pub use crate::traits::ManageConnection;
pub use crate::errors::{HandleError, NopErrorHandler, LoggingErrorHandler, Error};
pub use crate::conn_customize::{CustomizeConnection, NopConnectionCustomizer};
pub use crate::conn_pool::Pool;
pub use crate::conn_pooled::{State, PooledConnection};
pub use manager::RedisConnectionManager;
pub use r2d2::RedisPool;

pub(crate) mod config;
pub(crate) mod builder;
pub(crate) mod event;
pub(crate) mod extensions;
pub(crate) mod traits;
pub(crate) mod errors;
pub(crate) mod conn_utils;
pub(crate) mod conn_customize;
pub(crate) mod conn_pool;
pub(crate) mod conn_pooled;
pub(crate) mod manager;
pub(crate) mod cloud;


/// r2d2 is a generic connection pool.
pub mod r2d2;

#[cfg(test)]
mod test;

